/*
//
//              INTEL CORPORATION PROPRIETARY INFORMATION
//  This software is supplied under the terms of a license  agreement or
//  nondisclosure agreement with Intel Corporation and may not be copied
//  or disclosed except in  accordance  with the terms of that agreement.
//    Copyright (c) 2007-2008 Intel Corporation. All Rights Reserved.
//
//
*/

#ifndef __UMC_AVS_ENC_H
#define __UMC_AVS_ENC_H

#include "ippdefs.h"
#include "umc_video_encoder.h"

namespace UMC
{

enum
{
    AVS_PROFILE_JIZHUN          = 0x20
};

enum
{
    AVS_LEVEL_20                = 0x10,
    AVS_LEVEL_40                = 0x20,
    AVS_LEVEL_42                = 0x22,
    AVS_LEVEL_60                = 0x40,
    AVS_LEVEL_62                = 0x42
};

enum
{
    AVS_RC_CBR                  = 0,
    AVS_RC_VBR                  = 1
};

class AVSVideoEncoderParams : public VideoEncoderParams
{
    DYNAMIC_CAST_DECL(AVSVideoEncoderParams, VideoEncoderParams)

public:
    // Default constructor
    AVSVideoEncoderParams(void);
    // Destructor
    virtual
    ~AVSVideoEncoderParams(void);
    // Set params via par-file
    virtual Status ReadParamFile(const vm_char * ParFileName);
    virtual Status ReadParamFile(const vm_char * ParFileName, vm_char* /*InputYUVFileName*/);

    // you may specify valid positive value or set it to any
    // non-positive value to let the encoder make the decision
    Ipp32s m_maxGOPLength;                                      // (Ipp32s) maximum distance between intra frames

    // you may specify valid non-negative value or set it to any
    // negative value to let the encoder make the decision
    Ipp32s m_maxBLength;                                        // (Ipp32s) maximum length of B frame queue

    Ipp32u m_maxDelayTime;                                      // (Ipp32u) maximum delay time to get first encoded frame
    Ipp32u m_bitRateType;                                       // (Ipp32u) type of bitrate

    bool                m_bDeblocking;
    Ipp8s               m_iConstQuant;
    Ipp32u              m_uiNumFrames;
    Ipp32u              m_uiMESearchSpeed;
    bool                m_bInterlace;
    bool                m_bUseMeFeedback;
};

// forward declaration of used classes
class AVSEncFusionCore;
class AVSThread;
class SceneAnalyzerBase;

class AVSVideoEncoder : public VideoEncoder
{
public:
    // Default constructor
    AVSVideoEncoder(void);
    // Destructor
    virtual
    ~AVSVideoEncoder(void);

    // Initialize codec with specified parameter(s)
    virtual
    Status Init(BaseCodecParams *pInitParams);

    // Compress (decompress) next frame
    virtual
    Status GetFrame(MediaData *pSrc, MediaData *pDst);

    // Get codec working (initialization) parameter(s)
    virtual
    Status GetInfo(BaseCodecParams *pCodecParams);

    // Close all codec resources
    virtual
    Status Close(void);

    // Set codec to initial state
    virtual
    Status Reset(void);

protected:

    AVSEncFusionCore *m_pCore;                                  // (AVSEncFusionCore *) pointer to a AVS fusion core
    SceneAnalyzerBase *m_pSceneAnalyzer;                        // (SceneAnalyzerBase *) pointer to a scene analyzer

    AVSThread *m_pThreads;                                      // (AVSThread *) pointer to an array of working threads
    Ipp32u m_numThreads;                                        // (Ipp32u) current number of working threads

    AVSVideoEncoderParams m_internalParams;                     // internal copy of current encoder's params

};

} // namespace UMC

#endif // __UMC_AVS_ENC_H
